package com.zz.array;

public class L26Solution {
    public int removeDuplicates(int[] nums) {
        if(nums.length == 1){
            return 1;
        }
        int fast=0, last=1;
        while(last != nums.length){
            if(nums[fast] != nums[last]){
                nums[++fast] = nums[last++];
            }else{
                last++;
            }
        }
        return fast+1;
    }
}
